package net.zdreamer.geracomium.entity;

import com.example.geracomium.R;

import net.zdreamer.geracomium.ui.AssessContentFragment;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2015/1/21.
 */
public class AssessInfos implements Serializable {

    public ArrayList<Assessinfo> assessinfos = new ArrayList<Assessinfo>();
    private List<String> choice = new ArrayList<String>();

    public AssessInfos(JSONArray array) {
        for (int i = 0; i < array.length(); i++) {
            Assessinfo assessinfo = new Assessinfo();
            assessinfo.map.put("unchoice", R.drawable.unselected);
            assessinfo.ischecked = false;

            try {
                JSONObject jsonObject = new JSONObject(array.getString(i));
                assessinfo.answer = jsonObject.getString("content");
                assessinfo.score = jsonObject.getInt("score");
                assessinfos.add(assessinfo);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }


    public class Assessinfo {
        public Map<String, Integer> map = new HashMap<String, Integer>();
        public String answer;
        public boolean ischecked;
        public int score;
    }
}
